home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
cool
/
ge_cool.lha
/
GE_COOL2.1
/
src
/
Vector
/
TODO
< prev
next >
Wrap
Text File
|
1992-04-13
|
3KB
|
69 lines
Vector.h
Bug in ... in constructor, using va_arg.
The arguments in ... cannot be passed by reference. macro va_arg does funny
casting and does not enforce argument passing correctly, especially in case
of passing by reference.
prepend, remove_duplicates
Don't call constructors or operator= on the elements of this->data
operator[], fill, copy
When checking array boundaries, instead of
if (n < 0 || n >= this->number_elements) // If index out of range
do:
if ((unsigned long) n >= this->number_elements)
The cast makes negative n look very large.
DONE
operator==, position, search, push_new, remove, remove_duplicates, replace,
replace_all
This sits in a loop calling (*this->compare). Instead, make this->compare
default to NULL, and have two loops: one for the default case where
operator== on the value type is used, and another calling (*this->compare).
operator== and search are special cases
DONE
search, push_new, remove, remove_duplicates, replace, replace_all
there ought to be a general purpose, protected searching method, which is
fast (see above) used by all these methods.
Used find - DONE
copy, push, push_new, append, prepend, insert_before, insert_after
There needs to be a general purpose protected grow method, like in String.
The grow method should call resize to do most of the work.
DONE
reverse
This could be re-written to use pointers instead of indices.
Dividing the length by two can be eliminated, and a check for when
the top and bottom pointers meet or cross substituted.
remove, remove_duplicates, prepend, insert_before, insert_after
These need to be re-written to do their work in-place (i.e. no copying
to a temporary) The new and delete calls should go away.
DONE - prepend left as-is because it's likely to grow the vector
insert_before, insert_after
There are two versions of each of these. They should all call a common
private method which does the real work of inserting something at some index.
DONE
type##_vector_heap_sort
This needs to be merged into the sort method. There's no reason for
this friend function to exist, and it causes an extra .o file to be
produced by the implement script.
DONE
sort
Use the ansi C qsort function, instead of having one in the template.
If you feel that the heap sort algorithm is superior, write a general
purpose hsort function, with the same calling sequence as qsort.
hsort can be in the library instead of the template.
DONE
Vector<Type>(int n, Type* data)
Write a new constructor which makes a fixed size vector which shares
storage with the data argument
DONE